<?php


namespace app\controller\h5;


use app\Request;
use think\facade\View;

class User
{
    /**
     * 打开app
     * @param Request $request
     * @return string
     */
    public function openApp(Request $request)
    {

        $is_fair = false; // 是否是浏览器
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') === !1) {
            $is_fair = true;
        }
        View::assign([
            'is_fair' => $is_fair,
            'k' => $request->param('k', 1),
            'v' => $request->param('v', 1),
        ]);
        return View::fetch();
    }

    /**
     * 人机验证
     * @return string
     */
    public function verify(Request $request)
    {
        $type = $request->param('type');
        if (empty($type)) {
            return false;
        }
        View::assign('view', $request->param('type', ''));
        return View::fetch();
    }
}